<template>
    <div class="box">
        <h1>Child1 - 接收数据</h1>
    </div>
</template>

<script>
import Pubsub from 'pubsub-js'
export default {
    name: "Child1",
    mounted() {
        Pubsub.subscribe('sendData', this.receiveData)
    },
    methods: {
        // 参数一:
        //      消息类型
        // 参数二:
        //      真正的参数
        receiveData(type, params) {
            console.log(type, params)
        }
    }
}
</script>

<style scoped>

</style>